Skip to content

Conversation

@anecdata
Copy link
Member

@anecdata anecdata commented Mar 9, 2019

Client app code (previously crashed with TypeError: can't convert str to int in line 176), e.g.:

custom_headers = {"X-Moose" : "Bullwinkle",  "X-Squirrel" : "Rocky", }
response = wifi.get("https://example.com/", data=None, json=None, headers=custom_headers, stream=False)

Now results in request headers received by the remote server, e.g.:

HTTP_X_MOOSE: Bullwinkle
HTTP_X_SQUIRREL: Rocky

(Note: headers are case-insensitive and capitalization varies between server environments.)

@ladyada
Copy link
Member

ladyada commented Mar 9, 2019

not surprising - i never tested that stuff - but @brentru may have!

@brentru
Copy link
Member

brentru commented Mar 11, 2019

I didn't use custom headers like this originally as I ran into the same issue - was encoding the string from the client's init. Don't have to do that anymore though! Tested this PR on a PyPortal with a modified Adafruit IO CircuitPython library - and it's working with examples using post/get.

@brentru brentru merged commit 74eaea9 into adafruit:master Mar 11, 2019
@anecdata anecdata deleted the fix_optional_request_headers branch March 11, 2019 17:13
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants